package com.sykj.springboot.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.sykj.springboot.filter.LoginFilter;

@Configuration
public class FilterConfig {

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Bean
    public FilterRegistrationBean filterCheckLoginUserFilter(){
        FilterRegistrationBean filter = new FilterRegistrationBean();
        filter.setFilter(new LoginFilter());
        filter.addUrlPatterns("/*");
        filter.setName("loginFilter");
        //配置优先级，数值越大优先级越高
        filter.setOrder(1);
        return filter;
    }
}
